package practice2;
/*
 * 继承与多态
 */
public class Quadrangle {
	private Quadrangle[] qtest = new Quadrangle[3];
	private int nextIndex = 0;

	public void drow(Quadrangle q) {
		if (nextIndex < qtest.length) {
			qtest[nextIndex] = q;
			System.out.println(nextIndex);
			nextIndex++;
		}
	}

	public static void main(String[] args) {
						Quadrangle q=new Quadrangle(); 
					q.drow(new Square());//以子类对象作为形参
						q.drow(new parallelogramgle());
						}
}

class Square extends Quadrangle {
	public Square() {
		System.out.println("正方形");
	}
}

class parallelogramgle extends Quadrangle {
	public parallelogramgle() {
		System.out.println("四边形");
	}

}
